package com.fesine.blog.domain;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;

import javax.persistence.*;

/**
 * @description: 权限表，需要实现GrantedAuthority接口
 * @author: Fesine
 * @createTime:2017/12/19
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2017/12/19
 */
@Data
@Entity
public class Authority implements GrantedAuthority {
    private static final long serialVersionUID = 3652282134982896696L;

    /**
     * 定义主键，同时使用自增长策略
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 字段非空
     */
    @Column(nullable = false)
    private String name;

    @Override
    public String getAuthority() {
        return name;
    }
}
